﻿namespace KinonekoSoftware.CodariaDB
{
    public static class DataFactory
    {

        //
        //
        public static InstanceCache Create(InstanceType type, string name = null, string avatar = null, bool removable = true)
        {
            var utc = DateTime.Now;
            return new InstanceCache
            {
                Id             = ID.Get(),
                Name           = name,
                Avatar         = avatar,
                Type           = type,
                TimeOfCreated  = utc,
                TimeOfModified = utc,
                Removable      = removable,
            };
        }

        public static InstanceCache Create(string type, string name = null, string avatar = null, bool removable = true)
        {
            var utc = DateTime.Now;
            return new InstanceCache
            {
                Id             = ID.Get(),
                Name           = name,
                Avatar         = avatar,
                UseCustomType  = true,
                CustomType     = type,
                Type           = InstanceType.Custom,
                TimeOfCreated  = utc,
                TimeOfModified = utc,
                Removable      = removable,
            };
        }

        //
        //
        public static InstanceCache Create(InstanceType type, int extraType, string name = null, string avatar = null, bool removable = true)
        {
            var utc = DateTime.Now;
            return new InstanceCache
            {
                Id             = ID.Get(),
                Name           = name,
                Avatar         = avatar,
                Type           = type,
                ExtraType      = extraType,
                TimeOfCreated  = utc,
                TimeOfModified = utc,
                Removable      = removable,
            };
        }
    }
}